<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>Test CF_Table Classes</title>
		<link type="text/css" href="../css/humanity/jquery-ui-1.8.9.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="../js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="../js/jquery-ui-1.8.9.custom.min.js"></script>
		<script type="text/javascript" src="../CF_JS/CF_SyncVal.js"></script>
	</head>
	<body>
<?php

include_once "../../pdo_boot.php";

include_once "fieldspecs_spec.php";


$crudset_id = $_GET['crudset_id'];

$ar_data = get_array_query_full("SELECT * FROM fieldspecs WHERE 1 ", array(0=>array('var'=>'crudset_id','val'=>$crudset_id)));
//print_r($ar_data);
class FieldSpecTable extends CF_TableAjUpdate {


}
$fiters = '';
$tbl_fs = new FieldSpecTable($fieldspec,$ar_data,'fieldstbl');
$tbl_fs->set_actionpage("fieldspecs_ctl.php");

$fs = new CF_FieldSpec($fieldspec);
$lr = new CF_LookupResolver;
$fs->SetupLookupResolver($lr);

$table_id = lookup_value('main_table','crudsets'," crudset_id = $crudset_id ");


	$ar_columns = $fs->GetColumnsArray();
	//print_r($ar_columns);
$ar_lookups = $lr->GetLists($ar_columns, array('source_id'=>$table_id));
//$variable_list = $lr->GetList('variable_id', array('source_id'=>$table_id));
//echo "<pre>";
//print_r($variable_list);
//print_r($ar_lookups);
//echo "</pre>";

//$tbl_fs->ar_lookups['variable_id'] = $variable_list;
$tbl_fs->ar_lookups = $ar_lookups;

$html_fs = $tbl_fs->maketable();

?>
<script type="text/javascript">
<?php print $tbl_fs->make_supportJS() ?>
</script>
<table id='fieldstbl' name='fieldstbl'>
<thead>
<tr><?php print $tbl_fs->make_simple_heading() ?></tr>
</thead>
<tbody>
<?php print $html_fs ?>
</tbody>
</table>

<?php
$ab = new CF_AddBox($fieldspec, 'fieldspecs', $filters, 'fieldspecs_ctl.php');
$ab_form = $ab->make_add_box();
print $ab_form;
?>

</body>
</html>